//
//  OrderIngDetailViewController.m
//  UEAssistant
//
//  Created by mac on 2017/2/28.
//  Copyright © 2017年 youyixinxi. All rights reserved.
//

#import "OrderIngDetailViewController.h"
#import "OrderDetailTableViewCell.h"
#import "RCProgressView.h"
#import "OrderIngHeadCusView.h"
#import "PreviewViewController.h"

@interface OrderIngDetailViewController () <UITableViewDelegate,UITableViewDataSource> {
    
    NSArray                 *_titleArray;
    BOOL                    _isSuccess;
    NSMutableArray          *_types;
    
}

@property (nonatomic, strong) UIView                *redView;
@property (nonatomic, strong) UIView                *backView;
@property (nonatomic, strong) UITableView           *tableView;
@property (nonatomic, strong) UILabel               *orderType;
@property (nonatomic, strong) RCProgressView        *progressView;
@property (nonatomic, strong) UILabel               *progressValue;
@property (nonatomic, strong) UIImageView           *typeImageV;
@property (nonatomic, strong) UILabel               *tagLabel;
@property (nonatomic, strong) UILabel               *tagLabeltwo;
@property (nonatomic, strong) UILabel               *tagLabelThr;
@property (nonatomic, strong) UILabel               *tagLabelFour;
@property (nonatomic, assign) BOOL                  leadTitleTraint_bool;

@end

@implementation OrderIngDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUI];
    [self setData];
}


#pragma ------initlize-------
- (void)setUI{
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = self.teamName;
    
    [self.tableView registerNib:[UINib nibWithNibName:@"OrderDetailTableViewCell" bundle:nil] forCellReuseIdentifier:orderDetailCell];
    [self creatSubLayerView];
    
    [self.view addSubview:self.redView];
    [self.view addSubview:self.backView];
    
    self.backView.userInteractionEnabled = YES;
    [self.backView addSubview:self.tableView];
    self.tableView.contentSize = [self.tableView sizeThatFits:CGSizeMake(CGRectGetWidth(self.tableView.bounds), CGFLOAT_MAX)];
    
    _tableView.rowHeight =  UITableViewAutomaticDimension;
    _tableView.estimatedRowHeight = 30*Radio;
}

- (void)setData{
    
    _leadTitleTraint_bool = NO;
    _types = [NSMutableArray array];
    if (orderSingleton.segementIndex == 1) {
        //截取标签
        if (((NSString *)(_dataSource[5])).length != 0) {
            NSArray *tempArr = [_dataSource[5] componentsSeparatedByString:@","];
            TGLog(@"tempArr -- %@",tempArr);
            [tempArr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                
                [_types addObject:[obj substringFromIndex:NSMaxRange([obj rangeOfString:@"_"])]];
            }];
        }
    }
    
    if (orderSingleton.segementIndex == 0) {
        _titleArray = @[@"项目名称",
                        @"截止时间",
                        @"语种",
                        @"原文字数",
                        @"译文字数",
                        @"记忆库",
                        @"任务名称",
                        @""];
    }else {
        _titleArray = @[@"产生金额",
                        @"订单号",
                        @"发布时间",
                        @"截止时间",
                        @"单   价",
                        @"任务标签",
                        @"语   种",
                        @"任务字数",
                        @"完成字数",
                        @"下单人",
                        @"手机号",
                        @"任务名称",
                        @"任务描述"];
    }
}

- (void)creatSubLayerView{
    
    UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(50, 25+64+self.backView.frame.size.height+10, Screen_Width - 100, 20)];
    footView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.7];
    footView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    footView.layer.shadowOffset = CGSizeMake(0, 0);
    footView.layer.shadowOpacity = 0.7;
    footView.layer.shadowRadius = 3.0;
    footView.layer.cornerRadius = 3;
    [self.view addSubview:footView];
    
    UIView *midView = [[UIView alloc]initWithFrame:CGRectMake(40, 25+64+self.backView.frame.size.height, Screen_Width - 80, 22)];
    midView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.7];
    midView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    midView.layer.shadowOffset = CGSizeMake(0, 0);
    midView.layer.shadowOpacity = 0.7;
    midView.layer.shadowRadius = 3.0;
    midView.layer.cornerRadius = 3;
    [self.view addSubview:midView];
    
    
    UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(30, 25+64+self.backView.frame.size.height-10, Screen_Width - 60, 22)];
    topView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.7];
    topView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    topView.layer.shadowOffset = CGSizeMake(0, 0);
    topView.layer.shadowOpacity = 0.7;
    topView.layer.shadowRadius = 3.0;
    topView.layer.cornerRadius = 3;
    [self.view addSubview:topView];
    
    CALayer *layer = [CALayer layer];
    layer.frame = CGRectMake(20, 25+64, Screen_Width - 40, Screen_Height - 140);
    layer.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1].CGColor;
    layer.shadowOffset = CGSizeMake(0, 2);
    layer.shadowOpacity = 0.2;
    layer.shadowRadius = 3.0;
    layer.cornerRadius = 3;
    //这里self表示当前自定义的view
    [self.view.layer addSublayer:layer];
    
}

- (void)createFootHeadViewsAddToView:(UIView *)view{
    
    UILabel *progressLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, 20)];
    progressLabel.backgroundColor = [UIColor clearColor];
    progressLabel.text = @"完成进度";
    progressLabel.font = [UIFont systemFontOfSize:FLEXIBLE(14)];
    progressLabel.textColor = RGB(141, 141, 141, 1);
    progressLabel.textAlignment = NSTextAlignmentLeft;
    [view addSubview:progressLabel];
    
    _progressView = [[RCProgressView alloc] initWithFrame:CGRectMake(10,
                                                                     progressLabel.frame.size.height+5+8*Radio,
                                                                     Screen_Width - 40 - 70,
                                                                     8*Radio)];
    NSString *str = self.dataSource[7];
    CGFloat progress = [str floatValue];
    [_progressView setProgress:floorf(progress*100)/100];
    [view addSubview:_progressView];
    
    _progressValue = [[UILabel alloc]initWithFrame:CGRectMake(_progressView.frame.origin.x+_progressView.frame.size.width+10,
                                                              progressLabel.frame.size.height,
                                                              50,
                                                              20)];
    _progressValue.center = CGPointMake(_progressView.frame.origin.x+_progressView.frame.size.width+10+25, _progressView.center.y);
    _progressValue.backgroundColor = [UIColor clearColor];
    NSString *strr = [NSString stringWithFormat:@"%.0f",floorf(progress*100)];
    NSString *percentL = @"%";
    _progressValue.text = [NSString stringWithFormat:@"%@%@",strr,percentL];
    _progressValue.font = [UIFont systemFontOfSize:FLEXIBLE(13)];
    _progressValue.textColor = RGB(141, 141, 141, 1);
    _progressValue.textAlignment = NSTextAlignmentLeft;
    [view addSubview:_progressValue];
    
    
    UILabel *participation = [[UILabel alloc]initWithFrame:CGRectMake(10,
                                                                      _progressView.frame.origin.y+_progressView.frame.size.height+5,
                                                                      100,
                                                                      20)];
    participation.backgroundColor = [UIColor clearColor];
    participation.text = @"参与人";
    participation.font = [UIFont systemFontOfSize:FLEXIBLE(14)];
    participation.textColor = RGB(141, 141, 141, 1);
    participation.textAlignment = NSTextAlignmentLeft;
    [view addSubview:participation];
    
    OrderIngHeadCusView *leftV = [[OrderIngHeadCusView alloc]initWithFrame:CGRectMake(0, 0, 60*Radio, 90*Radio)];
    leftV.center = CGPointMake((Screen_Width - 40*Radio)/2 - 100*Radio, participation.center.y+participation.frame.size.height/2+5+leftV.frame.size.height/2);
    [leftV.headView sd_setImageWithURL:[NSURL URLWithString:self.dataSource[8][@"editUserFace"]] placeholderImage:[UIImage imageNamed:@"user"]];
    leftV.name.text = self.dataSource[8][@"editUsername"];
    leftV.personType.text = @"编辑";
    
    OrderIngHeadCusView *midV = [[OrderIngHeadCusView alloc]initWithFrame:CGRectMake(0, 0, 60*Radio, 90*Radio)];
    midV.center = CGPointMake((Screen_Width - 40*Radio)/2, participation.center.y+participation.frame.size.height/2+5+leftV.frame.size.height/2);
    [midV.headView sd_setImageWithURL:[NSURL URLWithString:self.dataSource[9][@"proofUserFace"]] placeholderImage:[UIImage imageNamed:@"user"]];
    midV.name.text = self.dataSource[9][@"proofUserName"];
    midV.personType.text = @"校对";
    
    OrderIngHeadCusView *rightV = [[OrderIngHeadCusView alloc]initWithFrame:CGRectMake(0, 0, 60*Radio, 90*Radio)];
    rightV.center = CGPointMake((Screen_Width - 40*Radio)/2+100*Radio, participation.center.y+participation.frame.size.height/2+5+leftV.frame.size.height/2);
    [rightV.headView sd_setImageWithURL:[NSURL URLWithString:self.dataSource[10][@"vmFace"]] placeholderImage:[UIImage imageNamed:@"user"]];
    
    rightV.name.text = self.dataSource[10][@"vmName"];
    rightV.personType.text = @"PM";
    
    [view addSubview:leftV];
    [view addSubview:midV];
    [view addSubview:rightV];
}

#pragma <UITableViewDelegate,UITableViewDataSource>

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    if (orderSingleton.segementIndex == 0) {
        return 8;
    }else{
        return self.dataSource.count;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (orderSingleton.segementIndex == 0) {
        OrderDetailTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:orderDetailCell forIndexPath:indexPath];
        cell.titleName.font = [UIFont systemFontOfSize:14];
        cell.infoLabel.font = [UIFont systemFontOfSize:16];
        if (Screen_Width == 320) {
            
            cell.titleName.font = [UIFont systemFontOfSize:13];
            cell.infoLabel.font = [UIFont systemFontOfSize:14];
        }
        cell.infoLabel.lineBreakMode = NSLineBreakByCharWrapping;
        cell.titleName.text = _titleArray[indexPath.row];
        cell.infoLabel.text = self.dataSource[indexPath.row];
        cell.infoLabel.numberOfLines = 0;
        
        if (indexPath.row == 0) {
            
            if (indexPath.row == 0) {
                _typeImageV = [[UIImageView alloc]initWithFrame:CGRectMake(Screen_Width-20-60, 0, 30*Radio, 38*Radio)];
                if ([self.orderTypeIng isEqualToString:@"翻译"]) {
                    _typeImageV.image = [UIImage imageNamed:@"translate"];
                }else if ([self.orderTypeIng isEqualToString:@"编辑"]){
                    _typeImageV.image = [UIImage imageNamed:@"compile"];
                }else{
                    _typeImageV.image = [UIImage imageNamed:@"proofread"];
                }
                [cell addSubview:_typeImageV];
            }
        }
        if (indexPath.row == 7) {
            [cell.titleName removeFromSuperview];
            [cell.infoLabel removeFromSuperview];
            
            //添加自定义视图
            [self createFootHeadViewsAddToView:cell];
        }
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }
    else{
        //来自平台
        OrderDetailTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:orderDetailCell forIndexPath:indexPath];
        if (Screen_Width == 320 && !_leadTitleTraint_bool) {
            cell.leadTitleTraint.constant -= 20;
        }
        cell.titleName.font = [UIFont systemFontOfSize:14];
        cell.infoLabel.font = [UIFont systemFontOfSize:16];
        if (Screen_Width == 320) {
            
            cell.titleName.font = [UIFont systemFontOfSize:13];
            cell.infoLabel.font = [UIFont systemFontOfSize:14];
        }
        cell.infoLabel.lineBreakMode = NSLineBreakByCharWrapping;
        cell.titleName.text = _titleArray[indexPath.row];
        cell.infoLabel.text = self.dataSource[indexPath.row];
        cell.infoLabel.numberOfLines = 0;
        
        if (indexPath.row == 0) {
            
            cell.infoLabel.textColor = RGB(230, 45, 50, 1);
            _typeImageV = [[UIImageView alloc]initWithFrame:CGRectMake(Screen_Width-20-60, 0, 30*Radio, 38*Radio)];
            if ([self.orderTypeIng isEqualToString:@"翻译"]) {
                _typeImageV.image = [UIImage imageNamed:@"translate"];
            }else if ([self.orderTypeIng isEqualToString:@"编辑"]){
                _typeImageV.image = [UIImage imageNamed:@"compile"];
            }else{
                _typeImageV.image = [UIImage imageNamed:@"proofread"];
            }
            [cell addSubview:_typeImageV];
            
        }
        if (indexPath.row == 5) {
            
            [cell.infoLabel removeFromSuperview];
            [self addTypeLabelsToView:cell];
        }
        if (indexPath.row == 11) {
            if (!_leadTitleTraint_bool) {
                if (Screen_Width == 320) {
                    cell.leadRightTraint.constant += 20*Radio;
                }else if (Screen_Width == 375){
                    cell.leadRightTraint.constant += 20*Radio;
                }else{
                    cell.leadRightTraint.constant += 30*Radio;
                }
            }
        }
        if (indexPath.row == 12) {
            
            if ([cell.subviews containsObject:_typeImageV]) {
                [_typeImageV removeFromSuperview];
            }
            if ([self.dataSource[12] isEqualToString:@""]) {
                _leadTitleTraint_bool = YES;
                cell.infoLabel.text = @"忽略这个";
                cell.infoLabel.textColor = [UIColor whiteColor];
                cell.infoLabel.font = [UIFont systemFontOfSize:FLEXIBLE(16)];
            }else{
                _leadTitleTraint_bool = YES;
                cell.infoLabel.textColor = RGB(96, 108, 130, 1);
                cell.infoLabel.font = [UIFont systemFontOfSize:FLEXIBLE(16)];
            }
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }
    
}

- (void)addBlueBtAndVIewToVIew:(UIView *)view{
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    if (Screen_Width == 320) {
        
        button.frame = CGRectMake(view.frame.size.width - 95*Radio - 15*Radio, 10*Radio, 65*Radio, 20*Radio);
        
    }else if(Screen_Width == 375){
        
        button.frame = CGRectMake(view.frame.size.width - 30*Radio - 15*Radio, 10*Radio, 65*Radio, 20*Radio);
        
    }else{
        
        button.frame = CGRectMake(view.frame.size.width - 15*Radio, 10*Radio, 65*Radio, 20*Radio);
    }
    button.backgroundColor = [UIColor whiteColor];
    [button setTitleColor:RGB(75, 191, 242, 1) forState:UIControlStateNormal];
    [button setTitle:@"查看原文" forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:FLEXIBLE(14)];
    button.titleLabel.textAlignment = NSTextAlignmentLeft;
    [button addTarget:self action:@selector(previewCurrentText) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:button];
    
    
}

- (void)previewCurrentText{
    
    TGLog(@"预览");
    self.hidesBottomBarWhenPushed = YES;
    PreviewViewController *VC = [[PreviewViewController alloc]init];
    if (orderSingleton.segementIndex == 0) {
        VC.sectorId = self.sectorId;
    }else{
        VC.plattask_id = self.plattask_id;
        VC.segmentIndex = 1;
    }
    [self.navigationController pushViewController:VC animated:YES];
}

- (void)addTypeLabelsToView:(UIView *)view{
    
    _tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(90, 30, 50*Radio, 20*Radio)];
    _tagLabel.backgroundColor = [UIColor whiteColor];
    _tagLabel.textColor = RGB(0, 179, 228, 1);;
    _tagLabel.textAlignment = NSTextAlignmentCenter;
    _tagLabel.font = [UIFont systemFontOfSize:FLEXIBLE(13)];
    _tagLabel.layer.cornerRadius = 10*Radio;
    _tagLabel.layer.masksToBounds = YES;
    _tagLabel.layer.borderColor = RGB(0, 179, 228, 1).CGColor;
    _tagLabel.layer.borderWidth = 1;
    [view addSubview:_tagLabel];
    
    _tagLabeltwo = [[UILabel alloc]initWithFrame:CGRectMake(_tagLabel.frame.origin.x+_tagLabel.frame.size.width+10, 30, 50*Radio, 20*Radio)];
    _tagLabeltwo.backgroundColor = [UIColor whiteColor];
    _tagLabeltwo.textColor = RGB(0, 179, 228, 1);;
    _tagLabeltwo.textAlignment = NSTextAlignmentCenter;
    _tagLabeltwo.font = [UIFont systemFontOfSize:FLEXIBLE(13)];
    _tagLabeltwo.layer.cornerRadius = 10*Radio;
    _tagLabeltwo.layer.masksToBounds = YES;
    _tagLabeltwo.layer.borderColor = RGB(0, 179, 228, 1).CGColor;
    _tagLabeltwo.layer.borderWidth = 1;
    [view addSubview:_tagLabeltwo];
    
    _tagLabelThr = [[UILabel alloc]initWithFrame:CGRectMake(_tagLabeltwo.frame.origin.x+_tagLabeltwo.frame.size.width+10, 30, 50*Radio, 20*Radio)];
    _tagLabelThr.backgroundColor = [UIColor whiteColor];
    _tagLabelThr.textColor = RGB(0, 179, 228, 1);;
    _tagLabelThr.textAlignment = NSTextAlignmentCenter;
    _tagLabelThr.font = [UIFont systemFontOfSize:FLEXIBLE(13)];
    _tagLabelThr.layer.cornerRadius = 10*Radio;
    _tagLabelThr.layer.masksToBounds = YES;
    _tagLabelThr.layer.borderColor = RGB(0, 179, 228, 1).CGColor;
    _tagLabelThr.layer.borderWidth = 1;
    [view addSubview:_tagLabelThr];
    
    _tagLabelFour = [[UILabel alloc]initWithFrame:CGRectMake(_tagLabelThr.frame.origin.x+_tagLabelThr.frame.size.width+10, 30, 50*Radio, 20*Radio)];
    _tagLabelFour.backgroundColor = [UIColor whiteColor];
    _tagLabelFour.textColor = RGB(0, 179, 228, 1);;
    _tagLabelFour.textAlignment = NSTextAlignmentCenter;
    _tagLabelFour.font = [UIFont systemFontOfSize:FLEXIBLE(13)];
    _tagLabelFour.layer.cornerRadius = 10*Radio;
    _tagLabelFour.layer.masksToBounds = YES;
    _tagLabelFour.layer.borderColor = RGB(0, 179, 228, 1).CGColor;
    _tagLabelFour.layer.borderWidth = 1;
    [view addSubview:_tagLabelFour];
    
    NSInteger index = _types.count;
    if (index == 3) {
        _tagLabel.text       = _types[0];
        _tagLabeltwo.text    = _types[1];
        _tagLabelThr.text    = _types[2];
        [_tagLabelFour removeFromSuperview];
    }
    else if (index == 2){
        _tagLabel.text       = _types[0];
        _tagLabeltwo.text    = _types[1];
        [_tagLabelThr removeFromSuperview];
        [_tagLabelFour removeFromSuperview];
    }
    else if (index == 1){
        _tagLabel.text       = _types[0];
        [_tagLabeltwo removeFromSuperview];
        [_tagLabelThr removeFromSuperview];
        [_tagLabelFour removeFromSuperview];
        
    }
    else if (index == 0){
        [_tagLabel removeFromSuperview];
        [_tagLabeltwo removeFromSuperview];
        [_tagLabelThr removeFromSuperview];
        [_tagLabelFour removeFromSuperview];
        
    }
    else{
        _tagLabel.text       = _types[0];
        _tagLabeltwo.text    = _types[1];
        _tagLabelThr.text    = _types[2];
        _tagLabelFour.text   = @"...";
    }
    if ([self.dataSource[2] isEqualToString:@""]) {
        [_tagLabel removeFromSuperview];
    }
    if (_types.count > 0) {
        
        CGSize size = [[NSString stringWithFormat:@"%@**",_types[0]] sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:FLEXIBLE(13)]}];
        CGSize sizeNew = CGSizeMake(ceilf(size.width), ceilf(size.height));
        if (Screen_Width == 320) {
            _tagLabel.frame     = CGRectMake(100-20, 9, sizeNew.width, 20*Radio);
        }else{
            _tagLabel.frame     = CGRectMake(100, 9, sizeNew.width, 20*Radio);
        }
    }
    if (_types.count > 1) {
        
        CGSize sizetwo = [[NSString stringWithFormat:@"%@**",_types[1]] sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:FLEXIBLE(13)]}];
        CGSize sizeNewtwo = CGSizeMake(ceilf(sizetwo.width), ceilf(sizetwo.height));
        _tagLabeltwo.frame  = CGRectMake(_tagLabel.frame.origin.x+_tagLabel.frame.size.width+10, 9, sizeNewtwo.width, 20*Radio);
        
    }
    if (_types.count > 2) {
        
        CGSize sizethr = [[NSString stringWithFormat:@"%@**",_types[2]] sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:FLEXIBLE(13)]}];
        CGSize sizeNewthr = CGSizeMake(ceilf(sizethr.width), ceilf(sizethr.height));
        _tagLabelThr.frame  = CGRectMake(_tagLabeltwo.frame.origin.x+_tagLabeltwo.frame.size.width+10, 9, sizeNewthr.width, 20*Radio);
        
    }
    if (_types.count > 3) {
        
        CGSize sizefour = [[NSString stringWithFormat:@"%@****",@"..."] sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:FLEXIBLE(13)]}];
        CGSize sizeNewfour = CGSizeMake(ceilf(sizefour.width), ceilf(sizefour.height));
        _tagLabelFour.frame = CGRectMake(_tagLabelThr.frame.origin.x+_tagLabelThr.frame.size.width+10, 9, sizeNewfour.width, 20*Radio);
        
        //如果字数太长就移除第四个
        NSString *tempS = [NSString stringWithFormat:@"%@%@%@",_types[0],_types[1],_types[2]];
        if (tempS.length > 10) {
            [_tagLabelFour removeFromSuperview];
        }
    }
}


#pragma getter

- (UIView *)redView{
    
    if (!_redView) {
        _redView = [[UIView alloc]initWithFrame:CGRectMake(21, 20+64, Screen_Width - 40-2, 50)];
        _redView.backgroundColor = RGB(60, 208, 152, 1);
        _redView.layer.cornerRadius = 5;
        _redView.layer.masksToBounds = YES;
    }
    return _redView;
}

- (UIView *)backView{
    
    if (!_backView) {
        _backView = [[UIView alloc]initWithFrame:CGRectMake(20, 25+64, Screen_Width - 40, Screen_Height - 140)];
        _backView.backgroundColor = [UIColor whiteColor];
        _backView.layer.shadowRadius = 3.0;
        _backView.layer.cornerRadius = 3;
        _backView.layer.masksToBounds = YES;
    }
    return _backView;
}

- (UITableView *)tableView{
    
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, Screen_Width-40*Radio, Screen_Height-140) style:UITableViewStylePlain];
        _tableView.backgroundColor = [UIColor colorWithWhite:1 alpha:1];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        _tableView.separatorColor = [UIColor clearColor];
        if (Screen_Width == 320) {
            _tableView.scrollEnabled = NO;
            _tableView.bounces = NO;
        }
        else{
            _tableView.scrollEnabled = NO;
            _tableView.bounces = NO;
        }
        if (orderSingleton.segementIndex != 0) {
            _tableView.scrollEnabled = YES;
            _tableView.bounces = YES;
        }
    }
    return _tableView;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}



@end

